<!-- 纳税人识别号控件 -->
<template>
  <a-space direction="vertical" style="width: 100%">
    <a-input
      disabled
      v-model="modelValue"
      :placeholder="props.props.placeholder"
    />
  </a-space>
</template>

<script lang="ts" setup>
  import { ref, computed, onMounted } from 'vue';
  import miiter from '@/utils/mitt';

  const props = withDefaults(
    defineProps<{
      props: { [propName: string]: any };
      name?: string;
      required?: boolean;
      oneValue: any;
      regex?: {
        [name: string]: {
          role: any;
          name: any;
        };
      };
    }>(),
    {}
  );
  const emit = defineEmits(['update:oneValue']);
  const modelValue = computed({
    get: () => {
      return props.oneValue;
    },
    set: (val) => {
      emit('update:oneValue', val);
    },
  });

  miiter.on('clientRefresh', (item: any) => {
    if (item.item.ein) {
      modelValue.value = item.item.ein;
      emit('update:oneValue', item.item.ein);
    } else if (item.item.extendDatas) {
      modelValue.value = item.item.extendDatas.taxpayerNo;
      emit('update:oneValue', item.item.extendDatas.taxpayerNo);
    }
  });
  onMounted(() => {});
</script>

<style scoped lang="less"></style>
